<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateFsOrganizationTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('fs_organizations', function (Blueprint $table) {
            $table->id();
            $table->string('name', 32)->default('')->comment('飞书组织名称');
            $table->json('apiConfig')->nullable()->comment('飞书api组织配置 - 现在默认用供应链prod配置，仅做接口信息获取');
            $table->string('remark', 128)->default('')->comment('备注');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->tinyInteger('isDeleted')->default(0);
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '飞书供应商组织表';
        });

        \App\Models\Common\FsOrganizationModel::query()->create([
            'name' => '夸父供应商',
            'apiConfig' => '{"appID": "cli_a3abf8bd8dbad00c", "AppSecret": "jRcDQ6t0wIzkUMiYKIIwAbdppXDnPQ5w"}',
            'remark' => '供应商1',
        ]);

        \App\Models\Common\FsOrganizationModel::query()->create([
            'name' => '夸父供应商2',
            'apiConfig' => '{"appID": "cli_a4d31202ff67900d", "AppSecret": "h2HCWoQtFbDOR3GVcWnCLhpl32zKfidZ"}',
            'remark' => '供应商2',
        ]);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('fs_organizations');
    }
}
